using SalesPages.DomainModel;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class RioUserMap : EntityTypeConfiguration<RioUser>
    {
        public RioUserMap()
        {
            // Primary Key
            this.HasKey(t => t.RioUserId);

            // Properties
            this.Property(t => t.UserName)
                .HasMaxLength(50);

            this.Property(t => t.Phone)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Email)
                .HasMaxLength(50);

            this.Property(t => t.Country)
                .IsFixedLength()
                .HasMaxLength(2);

            this.Property(t => t.City)
                .HasMaxLength(50);

            this.Property(t => t.School)
                .HasMaxLength(50);

            this.Property(t => t.Profile1)
                .HasMaxLength(50);

            this.Property(t => t.Profile2)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("RioUser");
            this.Property(t => t.RioUserId).HasColumnName("RioUserId");
            this.Property(t => t.UserName).HasColumnName("UserName");
            this.Property(t => t.Phone).HasColumnName("Phone");
            this.Property(t => t.Email).HasColumnName("Email");
            this.Property(t => t.Country).HasColumnName("Country");
            this.Property(t => t.City).HasColumnName("City");
            this.Property(t => t.School).HasColumnName("School");
            this.Property(t => t.IsEFStudent).HasColumnName("IsEFStudent");
            this.Property(t => t.Profile1).HasColumnName("Profile1");
            this.Property(t => t.Profile2).HasColumnName("Profile2");
            this.Property(t => t.HasLead).HasColumnName("HasLead");
            this.Property(t => t.CourseType).HasColumnName("CourseType");
            this.Property(t => t.InsertedDate).HasColumnName("InsertedDate");
            this.Property(t => t.ModifiedDate).HasColumnName("ModifiedDate");
        }
    }
}
